package com.community.process._1010.service;

import com.community.process._1010.common.enums.OrderStatusEnum;
import com.community.process._1010.dao.entity.ProcessOrder;
import com.community.process._1010.dao.entity.ProcessTOrder;
import com.community.process._1010.dao.query.ProcessOrderQuery;
import com.community.process._1010.dao.query.ProcessTOrderQuery;
import com.community.process._1010.dao.view.ProcessOrderView;
import com.community.process._1010.dao.view.ProcessTOrderView;
import com.community.process._1010.dao.vo.ProcessOrderQueryVo;
import com.community.process._1010.domains.ProcessOrderDTO;
import com.oneadds.lowcode.dto.PageListData;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description: 到餐加工订单
 * @Author: Administrator to Zbs
 * @Date: 2024/9/6 星期五 18:06
 */
public interface ProcessOrderService {

    /**
     * 购物车创建订单
     * @param dto 用户信息
     * @param userId 用户id
     */
    ProcessTOrderView createOrder(ProcessOrderDTO.CartCreateOrder dto, Long userId, HttpServletRequest request);


    /**
     * 小程序到餐购物车创建订单
     * @param dto 用户信息
     * @param userId 用户id
     */
    ProcessTOrderView cartMinieOrder(ProcessOrderDTO.CartCreateOrder dto, Long userId, HttpServletRequest request);

    /**
     * 查询主订单
     */
    PageListData<ProcessTOrderView> queryTOrder(ProcessTOrderQuery queryVo, Long userId);

    /**
     * 查询子订单
     */
    PageListData<ProcessOrderView> queryCOrder(ProcessOrderQuery queryVo, Long userId);

    /**
     * 查询子订单详情
     * @return 子订单详情
     */
    ProcessOrderView queryCOrderDetail(Long id);

    /**
     *
     * @param tid 主订单ID
     * @return 子订单列表
     */
    List<ProcessOrderView> queryCOrderList(Long tid);

    /**
     * 查询主订单详情
     * @param id 主订单ID
     * @return 主订单详情
     */
    ProcessTOrderView queryTOrderDetail(Long id);

    /**
     * 取消订单
     *
     * @param id      订单ID
     * @param userId  当前登录用户ID
     * @param request 请求体
     */
    void cancelAnOrder(Long id, Long userId, HttpServletRequest request);


    /**
     * 取消订单
     * @param tId 订单id
     */
    void cancelAnOrder(Long tId, OrderStatusEnum orderStatusEnum);

    /**
     * 申请退款
     * @param dto 订单ID
     * @param userId 当前登录用户ID
     * TODO 申请退款，如果后续有需要退款原因，让前端补个退款原因即可 refundReason
     */
    void applyForARefund(ProcessOrderDTO.ApplyForARefundDTO dto, Long userId);

    /**
     * 同意退款
     *
     * @param id      订单ID
     * @param userId  当前登录用户ID
     * @param request 请求体
     */
    void agreeToRefund(Long id, Long userId, HttpServletRequest request);

    /**
     * 拒绝退款
     * @param dto 退款订单ID
     * @param userId 当前登录用户ID
     */
    void refusedToRefund(ProcessOrderDTO.RefundForARefundDTO dto, Long userId);
}
